H5x.component("common.list", [], function(opts) {
    
}, {
    load_page:function(btn_text){
        var self = this;
        this.opts.pager = {
            page: 0,
            size: 10
        }

        this.activitydai.query({_orderd:"ctime"}, function(rs) {
            self.render("tp-common-list",{
                btn_text:btn_text
            });

             if(!btn_text){
                $("#common-qr-btn").remove();
              }     

            //self.bindAction();

            self.com_acselector = $(".ac-selector").make("ac-selector",{
                aclist:rs.list,
                onchange:function(q){
                    self.opts.pager = {
                        page: 0,
                        size: 10
                    }
                    self.opts.list_query = q;
                    self.load_list();
                }
            });  

            self.container.find(".search-btn").click(function(){
                var search = self.container.find(".search-input").val();
                //alert(search);
                if(search){
                    self.opts.pager = {
                        search:search,
                        page: 0,
                        size: 10
                    }
                }else{
                    self.opts.pager = {
                        page: 0,
                        size: 10
                    }
                }

                self.load_list();
                
            });
              

            
        })

    },

    //排序功能
    load_list: function() {
        var self = this;

        var q = this.opts.list_query;
        var query = {
            _orderd: "no",
            _page: this.opts.pager.page,
            _size: this.opts.pager.size,
            activityid:q.activityid
        };

        if(this.opts.paystatus){
            query.paystatus = this.opts.paystatus;
        }

        if(this.opts.status){
            query.status = this.opts.status;
        }


        if(this.opts.pager.search){
            query._search = this.opts.pager.search;
        }

        if(q.clazz != "all"){
            query.clazz = q.clazz;
        }
		
        /*
		if(this.choosendai){
			this.choosendai.query({activityno:"1007"},function(rs){
				console.log(rs);
			})
		}*/

        //console.log(query);

        (this.commondai||this.applydai).query(query,function(rs) {

            if(self.on_render_list){
                self.on_render_list(rs);
            }

            $(".pager-nav").make("pager", {
                pager: rs.pager,
                onchange: function(newpage, curpage) {
                    self.opts.pager.page = newpage;
                    self.load_list();
                }
            });
        });

    }
})
